package com.example.mapper;

import com.example.entity.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作activity_sign相关数据接口
 */
public interface OrderMapper {

    /**
     * 新增
     */
    int insert(Order order);

    /**
     * 删除
     */
    int deleteById(Integer id);

    /**
     * 修改
     */
    int updateById(Order order);

    /**
     * 根据ID查询
     */
    Order selectById(Integer id);

    /**
     * 查询所有
     */
    List<Order> selectAll(Order order);

    @Select("select * from activity_sign where activity_id = #{activityId} and user_id = #{userId} and status != '审核拒绝'")
    Order selectByActivityIdAndUserId(@Param("activityId") Integer activityId, @Param("userId") Integer userId);

    @Select("SELECT *,`user`.id as user_u_id FROM order_all  INNER JOIN  user ON order_all.user_id = user.id WHERE isdel = 0")
    List<Order> selectAllLeftUser(Order order);

}